// Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{namespace gitiles}

/**
 * Detail page showing diffs for a single commit.
 */
{template .diffDetail stricthtml="false"}
  {@param title: ?}  /** human-readable revision name. */
  {@param repositoryName: ?}  /** name of this repository. */
  {@param? menuEntries: ?}  /** menu entries. */
  {@param? customVariant: ?}  /** variant name for custom styling. */
  {@param breadcrumbs: ?}  /** breadcrumbs for this page. */
  {@param? commit: ?}  /** optional commit for which diffs are displayed, with keys corresponding to
      the gitiles.commitDetail template (minus "diffTree"). */
{call .header data="all" /}

{if $commit}
  {call .commitDetail data="$commit" /}
{/if}
{call .streamingPlaceholder /}

{call .footer}
  {param customVariant: $customVariant /}
{/call}
{/template}

/**
 * File header for a single unified diff patch.
 */
{template .diffHeader}
  {@param firstParts: ?}  /** parts of the first line of the header, with "text" and optional "url"
      fields. */
  {@param rest: ?}  /** remaining lines of the header, if any. */
  {@param fileIndex: ?}  /** position of the file within the difference. */
<pre class="u-pre u-monospace Diff">
  <a name="F{$fileIndex}" class="Diff-fileIndex"></a>
  {for $part in $firstParts}
    {if not isFirst($part)}{sp}{/if}
    {if $part.url}
      <a href="{$part.url}">{$part.text}</a>
    {else}
      {$part.text}
    {/if}
  {/for}{\n}
  {$rest}
</pre>
{/template}
